package com.wzdigit.wms.raw.service.mid;

import com.wzdigit.wms.basic.domain.mid.IfPostback;
import com.wzdigit.wms.basic.enums.writeback.BackResultEnum;
import com.wzdigit.wms.basic.mapper.core.mid.IfPostbackMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * <p>
 * 接口中间表-数据回传 服务实现类
 * </p>
 *
 * @author
 * @since 2021-03-11
 */
@Service
@Slf4j
public class IfPostbackService {

    @Autowired
    IfPostbackMapper ifPostbackMapper;


    /**
     * 新增一条记录
     *
     * @param ifPostback
     * @return
     */
    @Transactional(rollbackFor = Exception.class)
    public Integer addOne(IfPostback ifPostback) {

        ifPostback
                .setCreateTime(new Date())
                .setPostbackResult(BackResultEnum.DEFAULT_STATE.getCode());

        int row = ifPostbackMapper.insert(ifPostback);
        return row;
    }


}